import React from "react";
import Btn from "./Button";

class ButtonArray extends React.Component{
    constructor(props) {
        super(props);
        // this.props.stepNum;
        // this.props.toFather;
        this.childrenButtonClick = this.childrenButtonClick.bind(this);
    }
    childrenButtonClick(step) {
        this.props.toFather(step)
    }
    render() {
        let Array = [-1];
        for (let i = 0; i < this.props.stepNum-1 ; ++i){
            Array.push(i);
        }
        let buttonArray = Array.map((data,index) => {
            return <Btn toFather={this.childrenButtonClick} step={data} key={index}> </Btn>
        })
        return(
            <div>
                {buttonArray}
            </div>
        )
    }
}

export default ButtonArray;